Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(service-generator): New services architecture #38

Merged
merged 10 commits into from
Dec 19, 2024

Conversation

krzotki
Copy link
Collaborator

@krzotki krzotki commented Dec 6, 2024

Changed the structure of generated services:

  • Now instead of generating useXService and useXServiceLazy the dev is prompted with CRUD operations selection.
  • The generator will create a separate service hook for each of the CRUD operations.
  • For GET operations useQuery is used and for the other operations - useReactQueryLazy
  • the GET service hooks also exports queryX function, which allows for calling the query on SSR (the function accepts queryFn as a parameter, which usually would be a subapp function)
  • each service hook is filled with working example calls with proper method and parameters set

Screenshot 2024-12-06 at 11 58 12

Output:

UPDATE nx.json
CREATE libs/question/services/question-service/project.json
CREATE libs/question/services/question-service/.eslintrc.json
CREATE libs/question/services/question-service/.babelrc
CREATE libs/question/services/question-service/src/index.ts
CREATE libs/question/services/question-service/tsconfig.lib.json
CREATE libs/question/services/question-service/tsconfig.json
CREATE libs/question/services/question-service/jest.config.ts
CREATE libs/question/services/question-service/tsconfig.spec.json
UPDATE tsconfig.base.json
CREATE libs/question/services/question-service/src/README.md
CREATE libs/question/services/question-service/src/lib/useUpdateQuestion.ts
CREATE libs/question/services/question-service/src/lib/useQuestion.ts
CREATE libs/question/services/question-service/src/lib/useQuestions.ts

@krzotki krzotki marked this pull request as ready for review December 16, 2024 12:02
@krzotki krzotki merged commit e235743 into master Dec 19, 2024
17 checks passed
@krzotki krzotki deleted the new-services-architecture branch December 19, 2024 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants